package com.yuncheng.spcyApi.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.yuncheng.spcyApi.entity.SpcyFgXcjczj;
import com.yuncheng.spcyApi.mapper.SpcyFgXcjczjMapper;
import com.yuncheng.spcyApi.service.ISpcyFgXcjczjService;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;

import com.yuncheng.common.base.service.impl.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 审评查验-法律法规-现场检查章节
 * @Author: yuncheng
 * @Date: 2023-10-28
 * @Version: V1.0
 */
@Service
public class SpcyFgXcjczjServiceImpl extends BaseServiceImpl<SpcyFgXcjczjMapper, SpcyFgXcjczj> implements ISpcyFgXcjczjService {

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void batchInsertList(List<SpcyFgXcjczj> batchList) {
        if (CollectionUtil.isEmpty(batchList)){
            return;
        }

        List<List<SpcyFgXcjczj>> partition = ListUtils.partition(batchList, 50);
        partition.forEach(item -> {
            saveBatch(item);
        });

    }
}
